package com.changli05.compare.comparable;

import org.junit.Test;

import java.util.Arrays;

public class ComparableTest {

    @Test
    public void test() {

        String [] arr = new String[]{"Tom","Jerry","Lucy"};
        Arrays.sort(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    @Test
    public void test2() {

        Product [] p = new Product[6];

        p[0] = new Product("Huaweip30",5023);
        p[1] = new Product("Huaweip40",8900);
        p[2] = new Product("Huaweip50",5990);
        p[3] = new Product("Huaweip60",5010);
        p[4] = new Product("Huaweix60",5010);
        p[5] = new Product("Huaweip80",5300);

        Arrays.sort(p);
        for (int i = 0; i < p.length; i++) {
            System.out.println(p[i]);
        }
    }
}
